{% extends 'siteAdmin.html' %}
{% block operation %}
{% include 'tinyPart.html' with context %}

{% if req.path =='/staticPages/staticPagesAdd' %}

        <div id="box">
        {% if pageData['staticPages'].id %}
            <form method ="POST" action="/staticPages/staticPagesAdd?update={{pageData['staticPages'].id}}">
        {% else %}
            <form  method="POST" action="/staticPages/staticPagesAdd?add">
        {% endif %}

                <span class="word">TITOLO</span><br />
                <span class="insert">
                <input name="pageTitle" type="text" value ="{{pageData['staticPages'].title|nonone}}" style="width: 75%"/></span><br />

                <span class="word">CORPO </span><br />

                <textarea name="pageBody" rows="30" cols="50" style="width: 75%">{{pageData['staticPages'].body|nonone}}</textarea>
                            <div class="row thin lineTop">
            <span class="word">Seleziona la lingua predefinita:</span>
                    <select name="languageId">
<!--                     <option value="1">it</option> -->
                    {% for lang in pageData['language'] %}
                    <option value="{{lang.id}}">{{lang.denominazione}}</option>
                    {% endfor %}
                    </select>
                    </div>
                <input type="submit" class="wymupdate" value="Aggiungi/modifica"/>
            </form>

            <p>PERMALINK:<a href="/cms/{{pageData['staticPages'].permalink}}">{{pageData['staticPages'].permalink}}</a></p>
            <br />

        </div>
{% elif '/staticPages/staticPagesList' %}
        <div id="box">
                <span class="testa"><h2>Gestione contenuti statici</h2></span>
                <hr></hr>
                <div class="row normal">
                <a href="/staticPages/staticPagesAdd?new">
                    <img src="/templates/img/add.png" alt="aggiungi una pagina" title="aggiungi una pagina"/>
                </a>
                </div>
                {% for page in pageData['staticPages'] %}
                <div class="row normal lineTop" >
                    <span><a href="/cms/{{page.permalink}}">{{page.title}}</a>({{page.lang.denominazione_breve}})</span>
                    <span class="image">
                                            <a href="/staticPages/staticPagesAdd?edit={{page.id}}">
                                        <img src="/templates/img/modifica.png" alt="modifica una pagina" title="modifica una pagina"/></a><a href="/staticPages/staticPagesDel?pageId={{page.id}}"
                                        onClick='return confirm("Sei sicuro di voler cancellare questa pagina?")' >
                                        <img src="/templates/img/trash.png" alt="elimina una pagina" title="elimina una pagina"/></a>
</span>
                </div>
                {% endfor %}

                <div class="row normal lineTop">
                <a href="/staticPages/staticPagesAdd?new">
                    <img src="/templates/img/add.png" alt="aggiungi una pagina" title="aggiungi una pagina"/>
                </a>
                </div>
        </div>

{% endif %}
        </div>
{%endblock%}
